package org.dousb.douojbackendjudgeservice.judge.codesandbox;


import org.dousb.douojbackendjudgeservice.judge.codesandbox.impl.ExampleCodeSandbox;
import org.dousb.douojbackendjudgeservice.judge.codesandbox.impl.RemoteCodeSandbox;
import org.dousb.douojbackendjudgeservice.judge.codesandbox.impl.ThirdPartyCodeSandbox;

/**
 * CodeSandboxFactory
 * 代码沙箱工厂
 * 根据字符串参数创建指定的代码沙箱示例
 *
 * @author 豆沙包
 * @version 1.0
 * @since 2025-11-01  15:15
 */
public class CodeSandboxFactory {

    /**
     * 根据字符串参数创建指定的代码沙箱示例
     *
     * @param sandboxType
     * @return
     */
    public static CodeSandbox createCodeSandbox(String sandboxType) {
        switch (sandboxType) {
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}